﻿using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
namespace MTO.Framework.DirectoryServices.AccountManagement.Interfaces
{
    /// <summary>
    /// Définie toutes les méthodes qu'un AccountManager doit implémenter
    /// </summary>
    public interface IAccountManager
    {
        bool CreateUser(IUserAccount user, string password);

        bool ChangePassword(string identity, string oldPassword, string newPassword);
        
        bool SetPassword(string identity, string newPassword);
        
        bool DeleteUser(IUserAccount user);

        bool DeleteUser(string identity);
        
        IEnumerable<IUserAccount> GetAllUsers();
        
        IEnumerable<IUserAccount> GetAllUsers(IUserAccount searchQuery);
        
        IEnumerable<IUserAccount> GetAllUsers(int pageIndex, int pageSize, out int totalCount);
        
        IEnumerable<IUserAccount> GetAllUsers(int pageIndex, int pageSize, out int totalCount, IUserAccount searchQuery);
        
        IUserAccount GetUser(IUserAccount searchQuery);
        
        IUserAccount FindUserByIdentity(string identityValue);
        
        IUserAccount FindUserBySid(string identitySid);

        IUserAccount FindUserBySamAccountName(string identitySamAccountName);

        IUserAccount FindUserByUserPrincipalName(string identityUserPrincipalName);

        IUserAccount FindUserByName(string identityName);
        
        bool UpdateUser(IUserAccount user);
        
        bool ValidateCredentials(string userName, string password);
    }
}
